package tt.dz.order.pojo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;

/**
 * @Title 运营商信息表
 * @author zhoutian   
 * @date 2015-12-24
 */
public class Merchant {
	//运营商编码
	private String merchantCode;
	//企业简称
	private String shortName;
	//企业名称
	private String name;
	//是否自营：1 是，0 否
	private Integer isSelf;

	public String getMerchantCode() {
		return merchantCode;
	}

	public void setMerchantCode(String merchantCode) {
		this.merchantCode = merchantCode;
	}

	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getIsSelf() {
		return isSelf;
	}

	public void setIsSelf(Integer isSelf) {
		this.isSelf = isSelf;
	}

	public Merchant() {}
	
	private static final String select_all_sql = "select merchant_code as merchantCode, short_name as shortName, name, is_self as isSelf from ms_merchant";
	
	public static Merchant getById(String merchantCode){
		String sql = select_all_sql + " where merchant_code = :merchantCode";
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("merchantCode", merchantCode);
		return BaseDAOUtil.queryForObject(sql, paramMap, Merchant.class);
	}
	
	public static List<Merchant> getAll(){
		String sql = select_all_sql + " where is_valid = 1";
		return BaseDAOUtil.queryForList(sql, new HashMap<String, Object>(), Merchant.class);
	}
}
